﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace asscope.utils.controls
{
    public class DDownList
    {
        public void FillCountries(DropDownList ddl, asscope.core.Entities.Country[] entities)
        {
            ddl.Items.Clear();
            ddl.Items.Add(new ListItem("- Select -", ""));
            foreach (var cn in entities)
            {
                if (cn.id != string.Empty)
                {
                    ddl.Items.Add(new ListItem(cn.name, cn.code));
                }
            }              
        }


        public void FillTitles(DropDownList ddl, asscope.core.Entities.Title[] entities)
        {
            ddl.Items.Clear();
            ddl.Items.Add(new ListItem("- Select -", ""));
            foreach (var cn in entities)
            {
                if (cn.id != string.Empty)
                {
                    ddl.Items.Add(new ListItem(cn.name, cn.code));
                }
            }
        }

        public void FillSports(DropDownList ddl, asscope.core.Entities.Sport[] entities)
        {
            ddl.Items.Clear();
            ddl.Items.Add(new ListItem("- Select -", ""));
            foreach (var cn in entities)
            {
                if (cn.id != string.Empty)
                {
                    ddl.Items.Add(new ListItem(cn.name, cn.code));
                }
            }
        }



        public void FillYesNo(DropDownList ddl)
        {
            ddl.Items.Clear();
            ddl.Items.Add(new ListItem("- Select -", ""));
            ddl.Items.Add(new ListItem("Yes","Y"));
            ddl.Items.Add(new ListItem("No", "N"));
        }




    }
}
